<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/jquery.min.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/easydialog.min.js"></script>
<script type="text/javascript" src="${staticServer}/common/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/jquery.selectui.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/sweetalert.min.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/sweetalert-dev.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/jquery.pagination.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/const.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/jquery.cookie.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script>
//var infopad = parent.infopad;
$(function(){
	$("#type").val("<#if type??>${type}<#else>1</#if>");
});
function starquery()
{
	var url = "";
	var param_str = "";

		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var type = $("#type").val();
		
		if(sdate>edate){
			alert("选择日期出错。请重新选择！");
			$("#start_date").val(" ");
			$("#end_date").val(" ");
			return;
		}
		var params = [];
		if(!empty(sdate)) params.push("sdate=" + sdate);
		if(!empty(edate)) params.push("edate=" + edate);
		if(!empty(type)) params.push("type=" + type);
		url = "?" + params.join("&");
		location.href = "${contextPath}/oa/reserveXz.htm"+url;
}

function download(){
		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var type = $("#type").val();
		
		if(sdate=="" || edate==""){
		     alert("请选择时间段！");
		     return;
		}
		easyDialog.open({
			container : 'imgBox',
			fixed : true
		});
		$.post("${contextPath}/oa/consultant_client_reserve_list.json", {
		"sdate":sdate,"edate":edate,"type":type
	}, function(ms) {
			easyDialog.close();
			var name = ms.name;
			$("#type").val(ms.type);
			if(name!=""){
				var url = "http://120.55.241.58//mydata//uploadtea//xls//"+name;
				location.href = url;
			}else{
				alert("下载失败！ name= "+name)
			}
			
			/*var aLink = document.createElement('a');
    		var evt = document.createEvent("HTMLEvents");
    		evt.initEvent("click", false, false);
    		aLink.download = name;
    		aLink.href = url;
    		aLink.dispatchEvent(evt);*/
    		//alert(name+"文件已下载成功!请去（D:/mydata/uploadoa/）中查看");
	});	
}

//输入框回车事件
function EnterPress(e){
var e = e || window.event; 
if(e.keyCode == 13){ 
		var total = $("#total").val();
		var page = $("#pages").val();
		var address = $("#address").val();
		var phone = $("#phone").val();
		var email = $("#email").val();
		var qq = $("#qq").val();
		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var region = $("#region").val();
		var state = $("#state").val();
		var nickname = $("#nickname").val();
		var receptioner = $("#receptioner").val();
		var is_signer = $("#is_signer").prop("checked")?1:0;
		var is_receptioner = $("#is_receptioner").prop("checked")?1:0;
		var source = $("#sources").val();
		var nextpage = parseInt(page);
		var total1 = parseInt(total);
		
	if((nextpage > total1)){
		alert("输入的页数要小于总页数。");
	}else{
		location.href=encodeURI("${contextPath}/oa/consultant_client_reserve_list.htm?currPage="+page+"&nickname="+nickname+"&receptioner="+receptioner+"&address="+address+"&phone="+phone+"&email="+email+"&qq="+qq+"&sdate="+sdate+"&edate="+edate+"&region="+region+"&state="+state+"&is_signer="+is_signer+"&is_receptioner="+is_receptioner+"&source="+source);
		}
	} 
}

</script>
</head>

<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li></li>
			<li>客户预约资源下载</li>
			<li></li>
			<li class="current"></li>
		</ul>
	</div>
	<div id="container">
		<div id="imgBox" style="display:none">
  			<img src="http://localhost:8080/web/resource/img/xzjdt.gif" alt="" width="300px;" height="200px;" />
		</div>
		<div id="title"></div>
		<table class="simple_table" rel="nohover" style="min-width: 750px;">
			<tr>
				<td><label for="start_date">起始日期：</label>
				<input type="text" name="start_date" id="start_date" size="15"value="${sdate}" rel="DATE::Y-m-d" /> 
				<label for="end_date">终止日期：</label><input type="text"name="end_date" id="end_date" size="15" value="${edate}" rel="DATE::Y-m-d" />
				<select id="type">
					<option value="1">登记日期</option>
					<option value="2">预约日期</option>
				</select>
				<input type="button" value=" 查 询 " onclick="starquery()" />
				<input type="button" value=" 下 载 " onclick="download()" />
			</tr>
			
			
		</table>
		<table>
			<tr class="fields">
				<th>预约日期</th>
				<th>客户姓名</th>
				<th>预约中心</th>
				<th>所在地</th>
				<th>预约人</th>
				<th>接待人</th>
				<th>类型</th>
				<th>客户来源</th>
				<th>客户状态</th>
				<th>登记日期</th>
				<th>操作</th>
			</tr>
			
			<#if list??>
			<#list list as list>
			<tr class="even_row" id="${list.keyname}" name="${list.keyname}">
				<td align="center"><span class="quote">${list.date?date}</span><br>${list.time}</td>
				<td align="center" class="stress" width="100">${list.nickname}<em class="valid"><br/><#if list.invalid=="0">（有效）<#else>（无效）</#if></em></td>
				<td align="center">${list.regionns}</td>
				<td align="center">${list.province} - ${list.city}</td>
				<td align="center">${list.signer}</td>
				<td align="center">${list.receptioner}</td>
				<td align="center" name="${list.state}"><#if list.non=="0">测评<#else>非测评</#if></td>
				<td align="center">${list.sourcens}</td>
				<td align="center" width="100"><span class="confirmed unit hand"><#if list.state == 1>待确定<#elseif list.state == 2>已出现<#elseif list.state == 3 >未出现</#if></span></td>
				<td align="center">${list.startTime}</td>
				<td align="center"><a href="${contextPath}/index/system_reserve_view.htm?keyname=${list.keyname}">详细信息</a></td>
			</tr>
			</#list>
			</#if>
		</table>
		<div class="page_num" style="text-align:right;margin: 0px auto 0px auto;padding-right: 20px;">共<#if list??>${list?size}<#else>0</#if>条记录</div>
	</div>
	<div id="pager" style="width: 820px;">
	<ul id="pagination">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
		<input type="hidden" id="total" value="${page.pagetotal}">
				<#if currpage==1 >
					<li class="previous-off">首页</li>
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=1&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">首页</a></li>
					<li class="previous"><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${currpage-1}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${index_up}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${index_up}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${pagetotal}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=1&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${index_up}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${pagetotal}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=1&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${index_up}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		 <li class="previous-off">尾页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${currpage+1}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">下一页</a></li>
			<li class="previous"><a href="${contextPath}/index/consultant_client_reserve_list.htm?currPage=${page.pagetotal}&nickname=${nickname}&receptioner=${receptioner}&address=${address}&phone=${phone}&email=${email}&qq=${qq}&sdate=${sdate}&edate=${edate}&region=${region}&state=${state}&is_signer=${is_signer}&is_receptioner=${is_receptioner}&source=${source}">尾页</a></li>
		</#if>
		<li class="previous"><input type="text" id="pages" onkeypress="EnterPress(event)" size="10" placeholder="跳转页数" style="line-height: 30px; padding: 0 11px 0 11px;"></li>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul></div>
	<div class="emptyline"></div>
</body>
</html>